<template>
  <div class="notice">
    <!-- 公告 -->
    <div class="marquee" :style="{ backgroundColor: datas.backgroundColor }">
      <div class="tips-ma" :style="{ backgroundColor: datas.backgroundColor }">
        <el-icon><Bell /></el-icon>
      </div>
      <el-text class="marquee-text" :style="{ color: datas.textColor }">{{ datas.noticeText }}</el-text>
    </div>
    <!-- 删除组件 -->
    <slot name="deles" />
  </div>
</template>

<script lang="ts" setup name="Notice">
import { toRefs } from "vue";
const props = defineProps({
  datas: {
    type: Object
  }
});
const { datas } = toRefs(props);
</script>
<style lang="scss" scoped>
.marquee {
  display: flex;
  overflow: hidden;
  .tips-ma {
    z-index: 999;
    flex-shrink: 0;
    padding: 8px;
  }
  .marquee-text {
    white-space: nowrap;
    animation: scroll 15s linear infinite;
    &:hover {
      // 鼠标悬停 停止横向滚动
      animation-play-state: paused;
    }
  }
  .emphasize-days {
    font-weight: bold;
  }
}

@keyframes scroll {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(-100%);
  }
}
</style>
